package com.study.gupao.payport;

import java.util.HashMap;
import java.util.Map;

/**
 * 支付策略管理
 * Created by Tom.
 */
public class PayStrategy {
    public static final String RECHARGE_MONEY_MAX = "600";
    public static final String RECHARGE_MONEY_MEDIUM = "300";
    public static final String RECHARGE_MONEY_MIN = "200";
    public static final String DEFAULT_PAY = RECHARGE_MONEY_MAX;

    private static Map<String,Payment> payStrategy = new HashMap<String,Payment>();
    static {
        payStrategy.put(RECHARGE_MONEY_MAX,null);
        payStrategy.put(RECHARGE_MONEY_MEDIUM,new WechatPay());
        payStrategy.put(RECHARGE_MONEY_MIN,new UnionPay());
    }

    public static Payment get(String payKey){
        if(!payStrategy.containsKey(payKey)){
            return payStrategy.get(DEFAULT_PAY);
        }
        return payStrategy.get(payKey);
    }
}
